package com.sinry.api.aggregation.api;

import cn.hutool.core.bean.BeanUtil;
import com.sinry.api.aggregation.entity.ApiRegister;
import com.sinry.api.aggregation.service.ApiRegisterService;
import com.sinry.common.core.annotations.ResponseHandler;
import com.sinry.common.core.domain.dto.ApiRegisterDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author linxinlei
 * @project sinry-cloud
 * @description swagger数据api
 * @date 2022/5/22
 **/
@ResponseHandler
@RestController
@RequestMapping("/swagger/data")
public class SwaggerDataApi {


    private final ApiRegisterService apiRegisterService;

    @Autowired
    public SwaggerDataApi(ApiRegisterService apiRegisterService) {
        this.apiRegisterService = apiRegisterService;
    }

    @PostMapping("/save")
    public void save(@RequestBody ApiRegisterDto dto) {
        apiRegisterService.save(BeanUtil.copyProperties(dto, ApiRegister.class));
    }

}
